<?php
namespace app\admin\model;
use think\Db;
use think\Model;
class AdvertModel extends Model{
    public function index($area){
        return db('advert')->where('area',$area)->order('row desc')->select();
    }
    public function adcheck($id){
        return db('advert')->where('id',$id)->find();
    }
    public function dvertrepair($add,$translation){
        if ($add['id'] && $add['name'] && $add['area'] && $add['row'] && $add['state']){
            if ($translation != null){
                $add['url'] = $translation;
            }
            $add['time'] = time();
            db('advert')->where('id',$add['id'])->update($add);
            return true;
        }
        return '缺少参数';
    }
}